package com.tlvip.queue;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * <p>description：</p>
 * <p>copyright： copyright(C)2016-2099</p>
 * <p>Life is short,we need passion</p>
 * <p>Summary： </p>
 * <p>instructions： </p>
 * Date 2/15/21</p>
 * Author mac
 *
 * @version 1.0
 */
public class LinkedBlockingQueueTest {

    public static void main(String[] args) {
        LinkedBlockingQueue<String> linkedBlockingQueue = new LinkedBlockingQueue(5);
        linkedBlockingQueue.add(new Random().nextInt(9999) + "");
//        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor();


    }

    static class EnQueueTask implements Runnable {
        private LinkedBlockingQueue<String> linkedBlockingQueue;

        private String value;

        public EnQueueTask(LinkedBlockingQueue<String> linkedBlockingQueue, String value) {
            this.linkedBlockingQueue = linkedBlockingQueue;
            this.value = value;
        }

        @Override
        public void run() {
            linkedBlockingQueue.add(value);
        }
    }


}
